export const getTime = () => {
  let message = ''
  let hours = new Date().getHours()

  if(hours <= 9){
    message = '早上'
  } else if (hours <= 12){
    message = '中午'
  } else if(hours <= 18){
    message = '下午'
  } else {
    message = '晚上'
  }

  return message
}

export const shortcuts = [
  {
    text: 'Today',
    value: new Date(),
  },
  {
    text: 'Tommorrow',
    value: () => {
      const date = new Date()
      date.setTime(date.getTime() + 3600 * 1000 * 24)
      return date
    },
  },
  {
    text: 'A week later',
    value: () => {
      const date = new Date()
      date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
      return date
    },
  },
]

export const disabledDate = (time: Date) => {
  return time.getTime() < Date.now()
}

export const formatDate = (dateStr: string) => {
  if (!dateStr) return '-'
  const date = new Date(dateStr)
  return `${date.getFullYear()}年${(date.getMonth() + 1).toString().padStart(2, '0')}月${date.getDate().toString().padStart(2, '0')}日`
}

export const formatDateISOS = (dateStr: string) => {
  const date = new Date(dateStr)
  date.setMinutes(date.getMinutes() - date.getTimezoneOffset())
  return date.toISOString()
}